﻿#include "camerathread.h"

CameraThread::CameraThread(QObject *parent) : QObject(parent)
{
	m_worker = new CameraWorker();
	m_worker->moveToThread(&m_workThread);
    connect(this, &CameraThread::sigInitialize, m_worker, &CameraWorker::Initialize);
    connect(this, &CameraThread::sigStart, m_worker, &CameraWorker::start);
	connect(this, &CameraThread::sigStop, m_worker, &CameraWorker::stop);
    connect(&m_workThread, &QThread::finished, m_worker, &QObject::deleteLater);
	m_workThread.start();
}
CameraThread::~CameraThread()
{
    m_workThread.quit();
    m_workThread.wait();
}
void CameraThread::Initialize()
{
    emit sigInitialize();
}

void CameraThread::start()
{
	emit sigStart();
}

void CameraThread::stop()
{
	emit sigStop();
}


